<?php 
/****
布尔教育 高端PHP培训
培  训: http://www.itbool.com
论  坛: http://www.zixue.it
****/

namespace Home\Controller;
use Think\Controller;

class UserController extends Controller{
	public function add(){
		$a = 123;
		$this->assign('b',$a);
		$this->display();
	}

	public function ff(){
		$post = I('id');
		echo $post;exit;
		$a = new \Home\Model\UserModel();
		//过程化风格
		//$d = $a->add(['username'=>'也骚','email'=>'123123@qq.com']);
		$a->username = '叶骚';
		$a->email = '888@qq.com';
		//add是模板封装好的父类方法
		$a->add();
		var_dump($a);
	}

	public function cha(){
		$usermodel = D('user');
		var_dump($usermodel->field('user_id,username,email')->where('user_id<200')->order('user_id desc')->limit(2,1)->select());
	}

	public function up(){
		$uerM = D('User');
		$arr = array('username'=>'biantai');
		$a = $uerM->where('user_id>124')->save($arr);
		echo $a;
	}

	public function de(){
		$useM = D('User');
		//$useM->delete('124');
		$a=$useM->where('user_id>125')->delete();
		echo $a;
	}
}

?>